package io.characterStream.fileRorW;

import java.io.FileReader;
import java.io.IOException;

/*
FileReader用于读取纯文本文件，解决中文乱码问题
    FileReader内置了长度为8192字节数组
 */
public class FileReader1 {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("E:\\A.txt");
        char[] ch = new char[1024];
        int len;
        while ((len = fr.read(ch)) != -1) {
            String str = new String(ch, 0, len);
            System.out.println(str);
        }
        fr.close();
    }

    private static void method1(FileReader fr) throws IOException {
        int i;
        while((i= fr.read())!=-1){
            System.out.print((char)i);
        }
        fr.close();
    }
}
